<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/vue.js" type="text/javascript">
			
		</script>
		<style type="text/css">
			.active{
				color: red;
			}
			
		</style>
	</head>
	<body>
		<div id = "app">
			<ul>
				<li v-for="(item,index) in movies" :class="{active:currentIndex ===index}" @click="changeColor(index)">{{item}}</li>
			</ul>
		</div>
	</body>
	<script type="text/javascript">
		const app = new Vue({
			el:"#app",
			data:{
				movies:["电影1","电影2","电影3"],
				active:true,
				currentIndex:0,
			},
			methods:{
				changeColor(index){
					this.currentIndex = index;
				}
			}
		})
	</script>
</html>
